package com.vhall.component.entity.interactive.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @author shimingming
 * @since 2023/6/7 11:04
 */
@Getter
@AllArgsConstructor
public enum DataMarketTypeEnum {

    /**
     * 类型
     * 直播观看数据（按栏目) dpColumn
     * 直播观看数据（按主播) dpAnchor
     * 观看时段top dpWatchTimeTop
     * 用户观看时长分布 dpUserView
     */

    DP_COLUMN("dpColumn", "直播观看数据（按栏目）"),
    DP_ANCHOR("dpAnchor", "直播观看数据（按主播）"),
    DP_WATCH_TIME_TOP("dpWatchTimeTop", "观看时段top"),
    DP_USER_VIEW("dpUserView", "用户观看时长分布"),


    ;
    private final String value;

    private final String description;

    public static String getDescription(String value) {
        DataMarketTypeEnum parse = parse(value);
        if (parse != null) {
            return parse.getDescription();
        }
        return StringUtils.EMPTY;
    }

    public static DataMarketTypeEnum parse(String value) {
        for (DataMarketTypeEnum anEnum : DataMarketTypeEnum.values()) {
            if (anEnum.getValue().equals(value)) {
                return anEnum;
            }
        }
        return null;
    }
}
